import axios from "axios"//这行代码导入了axios库 方便请求
import {get} from '@/utils/storage'

const instance=axios.create({
    baseURL:'/dev-api'
})//创建axios实例


  instance.interceptors.request.use(function (config) {
    // Do something before request is sent
    const token=get('user_token')
    console.log(`token: ${token}`);
    config.headers.Authorization=`Bearer ${token}`
    //token 添加到请求头中
    return config;
  }, function (error) {
    // Do something with request error
    return Promise.reject(error);
  });

export default instance

